<template>
    <div class="float-panel" v-show="isVisible" :style="{
        left: position.left + 'px',
        top: position.top + 'px'
    }" @mouseenter="$emit('mouse-enter')" @mouseleave="$emit('mouse-leave')">
        <div class="panel-header">
            <span class="panel-title-text">{{ stationName }}</span>
        </div>
        <div class="panel-content">
            <p>运行状态：{{ stationStatus }}</p>
            <p>最后更新：{{ updateTime }}</p>
        </div>
    </div>
</template>
<script setup>
const props = defineProps({
    isVisible: {
        type: Boolean,
        default: false
    },
    position: {
        type: Object,
        default: () => ({ left: 0, top: 0 })
    },
    stationName: {
        type: String,
        default: ''
    },
    stationStatus: {
        type: String,
        default: '正常'
    },
    updateTime: {
        type: String,
        default: ''
    }
});
const emit = defineEmits(['mouse-enter', 'mouse-leave']);
</script>
<style scoped>
.float-panel {
    position: absolute;
    width: 250px;
    background-color: rgba(10, 30, 60, 0.9);
    border: 1px solid rgba(204, 204, 204, 0.3);
    color: white;
    box-sizing: border-box;
    z-index: 20;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
}

.float-panel .panel-header {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(204, 204, 204, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.float-panel .panel-title-text {
    font-weight: bold;
    color: #02a6b5;
}

.float-panel .panel-content {
    padding: 12px;
    font-size: 14px;
}

.float-panel .panel-content p {
    margin: 8px 0;
    line-height: 1.5;
}

.float-panel::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    border-width: 10px 10px 10px 0;
    border-style: solid;
    border-color: transparent rgba(10, 30, 60, 0.9) transparent transparent;
}

@media (max-width: 768px) {
    .float-panel {
        width: 200px;
        font-size: 12px;
    }
}
</style>